﻿<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>图像和颜色的绘制</title>
</head>
<body>
<?php
    header("Content-type:image/png");	
	$im=imagecreate(500,500);		
	$black=ImageColorAllocate($im, 0,0,0);	
	$white=ImageColorAllocate($im, 255,255,255);
	$yellow=ImageColorAllocate($im,255,255,0);	
	$blue =ImageColorAllocate($im,0,0,255);
	$red=ImageColorAllocate($im,255,0,0);
	$zi=ImageColorAllocate($im,255,0,255);		
	$background_color = imagecolorallocate($im,255,255,255);
	imageline($im,10,10,350,10,$white);
	imagerectangle($im,20,20,200,100,$blue);
	imagefilledrectangle($im,100,300,200,400,$yellow);
	imageellipse($im,200,200,150,150,$zi);
	imagefilledellipse($im,400,300,150,350,$white);	
	ob_clean();  
	flush();
	imagepng($im);			
	imagedestroy($im);
?>
</body>
</html>